home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / OPTIONS.ASM < prev    next >
Assembly Source File  |  1993-05-05  |  4KB  |  128 lines

  1. ;*********************************;
  2. ; SESSION Command Line Parameters ;
  3. ;          By Eric Tauck          ;
  4. ;*********************************;
  5.  
  6. ;--- data
  7.  
  8. errorm  DB      'Error in parameters, run "SESSION ?" for help',0
  9.  
  10. helpm   LABEL   BYTE
  11.  DB 13,10
  12.  DB 'Usage: SESSION [macro_file] [options]',13,10
  13.  DB 13,10
  14.  DB 'Serial Port                         | Configuration',13,10
  15.  DB '----------------------------------- | ---------------------------------',13,10
  16.  DB '/Pn    port number (1, 2)           | /Onnnn options (add values below)',13,10
  17.  DB '/Bnnnn baud rate (300, 1200, 2400)  |      1 local echo',13,10
  18.  DB '/Rn    parity (0=none,1=odd,2=even) |      2 split screen',13,10
  19.  DB '/Dn    data bits (7, 8)             |     16 append LF to CR',13,10
  20.  DB '/Sn    stop bits (1, 2)             |     32 strip high bit',13,10
  21.  DB '                                    |     64 fast xmodem',13,10
  22.  DB 'Video Mode                          |    128 1K xmodem',13,10
  23.  DB '----------------------------------- |    256 enable ANSI',13,10
  24.  DB '/Vnn video mode                     |    512 detect loss of carrier',13,10
  25.  DB '   8 cols=80, rows=12 (VGA color)   |   2048 filter control chars',13,10
  26.  DB '   9 cols=80, rows=14 (VGA color)   |   8192 enable macro debugging',13,10
  27.  DB '  10 cols=80, rows=21 (VGA)         |',13,10
  28.  DB '  11 cols=80, rows=25               | Miscellaneous',13,10
  29.  DB '  12 cols=80, rows=28 (VGA)         | ---------------------------------',13,10
  30.  DB '  13 cols=80, rows=43 (EGA, VGA)    | /Cn  color (0=def,1=color,2=b/w)',13,10
  31.  DB '  14 cols=80, rows=50 (VGA)         | /Nn  noise (0=quiet, 1=noisy)',13,10
  32.  DB '                                    | /Tnn text pacing (in ticks)'
  33.  DB 0
  34.  
  35. ;========================================
  36. ; Get and process all command line
  37. ; options.
  38. ;
  39. ; Out: AX= name of macro file or 0 if
  40. ;      none.
  41.  
  42. Get_Options     PROC    NEAR
  43.         push    di
  44.         push    si
  45.         push    bp
  46.         sub     bp, bp          ;macro file name
  47.         jmps    getopt2
  48.  
  49. ;--- loop for each argument
  50.  
  51. getopt1 mov     bp, si          ;return as macro file
  52.         dec     bp              ;
  53.         dec     bp              ;point to start
  54.  
  55. getopt2 call    ParGet          ;get parameter
  56.         jc      getopt5         ;exit if done
  57.         mov     si, ax
  58.  
  59.         call    StrUpr          ;convert to uppercase
  60.         mov     ax, [si]        ;load first two bytes
  61.         inc     si
  62.         inc     si              ;skip option string
  63.  
  64.         cmp     al, '?'
  65.         je      getopt4
  66.         cmp     ah, '?'
  67.         je      getopt4
  68.         cmp     al, '/'
  69.         jne     getopt1
  70.         mov     di, OFFSET c_port
  71.         cmp     ax, '/P'
  72.         je      getopt6
  73.         mov     di, OFFSET c_speed
  74.         cmp     ax, '/B'
  75.         je      getopt6
  76.         mov     di, OFFSET c_party
  77.         cmp     ax, '/R'
  78.         je      getopt6
  79.         mov     di, OFFSET c_data
  80.         cmp     ax, '/D'
  81.         je      getopt6
  82.         mov     di, OFFSET c_stop
  83.         cmp     ax, '/S'
  84.         je      getopt6
  85.         mov     di, OFFSET trmflg
  86.         cmp     ax, '/O'
  87.         je      getopt6
  88.         mov     di, OFFSET pacetime
  89.         cmp     ax, '/T'
  90.         je      getopt6
  91.         mov     di, OFFSET sndflg
  92.         cmp     ax, '/N'
  93.         je      getopt6
  94.         mov     di, OFFSET mode
  95.         cmp     ax, '/V'
  96.         je      getopt6
  97.         mov     di, OFFSET color
  98.         cmp     ax, '/C'
  99.         je      getopt6
  100.  
  101. ;--- invalid option
  102.  
  103. getopt3 mov     ax, OFFSET errorm
  104.         jmp     error2
  105.  
  106. ;--- display help
  107.  
  108. getopt4 mov     ax, OFFSET helpm
  109.         jmp     error2
  110.  
  111. ;--- finished
  112.  
  113. getopt5 mov     ax, bp          ;return macro file name
  114.         pop     bp
  115.         pop     si
  116.         pop     di
  117.         ret
  118.  
  119. ;--- store option value
  120.  
  121. getopt6 mov     ax, si
  122.         mov     cx, 10          ;base 10
  123.         call    Str2Num         ;convert to number
  124.         jc      getopt3         ;jump if error
  125.         mov     [di], ax        ;save parameter
  126.         jmp     getopt2
  127.         ENDP
  128.